package com.bindatax.core.config;

import com.bindatax.core.util.PropertiesUtil;
import lombok.Getter;
import lombok.Setter;

import java.util.Properties;


@Getter
@Setter
public class SysConfig {
    public final static String key_concurrencyQueryMinSize = "trans.concurrency.query.minSize";
    public final static String key_logSystemType = "trans.log.system.type";

    private static Properties pros;
    private static int concurrencyQueryMinSize;//一个任务最少同时处理多少条SQL语句
    private static String logSystemType;//使用什么日志系统

    private SysConfig(){}

    public static void readPros(Properties pros){
        concurrencyQueryMinSize = PropertiesUtil.get(pros,key_concurrencyQueryMinSize,5);//一个任务最少同时处理多少条SQL语句
        logSystemType = PropertiesUtil.get(pros,key_logSystemType,"log4j");//使用什么日志系统
    }

    public static Properties getPros() {
        return pros;
    }

    public static void setPros(Properties pros) {
        SysConfig.pros = pros;
        readPros(pros);
    }

    public static int getConcurrencyQueryMinSize() {
        return concurrencyQueryMinSize;
    }

    public static void setConcurrencyQueryMinSize(int concurrencyQueryMinSize) {
        SysConfig.concurrencyQueryMinSize = concurrencyQueryMinSize;
    }

    public static String getLogSystemType() {
        return logSystemType;
    }

    public static void setLogSystemType(String logSystemType) {
        SysConfig.logSystemType = logSystemType;
    }
}
